Release 10.1A: OpenEdge Development:
Java Open Clients


Passing INPUT parameters

Passing an INPUT parameter requires several steps to provide a value as input to an application service procedure or user-defined function.

To pass an INPUT parameter:

  1. Create and initialize a variable for the parameter of the correct Java data type (see the "Creating variables for parameters" section).
  2. Add the parameter to a ParamArray object (see the "Setting up a parameter array" section).
  3. Run the procedure or user-defined function (see the "Running procedures and user-defined functions" section).

For example, to pass an INPUT integer parameter that does not support the Unknown value (?), you might do the following:

Passing an INPUT parameter using the Java OpenAPI
// Connect to the AppServer 
OpenAppObject dynAO = new OpenAppObject("asbroker1"); 
// Define and initialize the variable for the input parameter 
int CustomerNumber = 33; 
// Create the ParamArray 
ParamArray parms = new ParamArray(1); 
// Add the input parameter to the ParamArray 
parms.addInteger(0, CustomerNumber, ParamArrayMode.INPUT); 
// Run the procedure or user-defined function 
dynAO.runProc("AddCustomer.p", parms); 
... 

To pass an INPUT integer parameter that supports the Unknown value (?), you might do the following:

Passing an INPUT parameter as the Unknown value (?) using the Java OpenAPI
// Connect to the AppServer 
OpenAppObject dynAO = new OpenAppObject("asbroker1"); 
// Define and initialize the variable for the input parameter 
Integer CustomerNumber = new Integer(33); 
// Code possibly affecting the value of CustomerNumber 
... 
//Set the Integer value for the input parameter  
//to null or an int based on the variable value 
if (CustomerNumber.intValue() > 33) 
   CustomerNumber = null; 
// Create the ParamArray 
ParamArray parms = new ParamArray(1); 
// Add the input parameter to the ParamArray 
parms.addInteger(0, CustomerNumber, ParamArrayMode.INPUT); 
// Run the procedure or user-defined function 
dynAO.runProc("AddCustomer.p", parms); 
... 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095